Skip to content

Conversation

@zachleat
Copy link

@zachleat zachleat commented May 16, 2023

This restores non-patched behavior for standalone next server.

Description

When you run next dev standalone after netlify dev has patched Next files, it can skip middleware and other configuration. This makes the patches a little more defensive, requiring process.env.NETLIFY to be in place. This is important as the other ENV variable checks were !== 'true' which successfully passed when next dev was in use.

Tests

This test case was validated https://github.com/anthonyholmes/next-netlify-middleware-bug (noting that step 6 in the readme is inaccurate)

Relevant links (GitHub issues, etc.) or a picture of cute animal

image

Fixes netlify/pod-ecosystem-frameworks#474

this keeps previous behavior for standalone next server
@zachleat zachleat requested a review from a team as a code owner May 16, 2023 14:48
@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/647fa76ad8130a00089aa4fd
😎 Deploy Preview https://deploy-preview-2117--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/647fa76a7b3d7b000751f93c
😎 Deploy Preview https://deploy-preview-2117--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/647fa76abce1d10009be5cb3
😎 Deploy Preview https://deploy-preview-2117--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/647fa76a1768ee0008d1cdbd
😎 Deploy Preview https://deploy-preview-2117--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/647fa76a91df210008386b04
😎 Deploy Preview https://deploy-preview-2117--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/647fa76a450cd60008b71fa7
😎 Deploy Preview https://deploy-preview-2117--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: bug code to address defects in shipped code label May 16, 2023
@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/647fa76a30cd3d000875d21b
😎 Deploy Preview https://deploy-preview-2117--next-plugin-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/647fa76ad4cfe300083d6a0c
😎 Deploy Preview https://deploy-preview-2117--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit f65531d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/647fa76a6cc300000985a431
😎 Deploy Preview https://deploy-preview-2117--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@orinokai orinokai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @zachleat, lgtm 🚢

@kodiakhq kodiakhq bot merged commit 6bdaec1 into main Jun 7, 2023
@kodiakhq kodiakhq bot deleted the zl/middleware-patch-474 branch June 7, 2023 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Ecosystem: Frameworks type: bug code to address defects in shipped code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants